package com.easthome.service.impl;

import com.easthome.entity.Manager;
import com.easthome.entity.UserInfo;
import com.easthome.mapper.UserMapper;
import com.easthome.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author cxiaoy
 * @Date 2022/10/18 11:02
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public UserInfo login(UserInfo user) {
        return userMapper.login(user);
    }

    @Override
    public boolean checkUsername(String userName) {
//        int r = userMapper.checkUsername(userName);//count(*)
//        return r>0;

        return userMapper.checkUsername(userName);
    }

    @Override
    public int register(UserInfo user) {
        return userMapper.insert(user);
    }

    @Override
    public Manager loginM(Manager manager) {
        return userMapper.loginM(manager);
    }
}
